export interface ColumnProps {
  _id: number;
  title: string;
  avatar?: string;
  description: string;
}

export interface UserProps {
  isLogin: boolean;
  nickName?: string;
  _id?: string;
  column?: string;
  email?: string;
  avatar?: string;
  description?: string;
}

export interface RuleProps {
  type: "required" | "email";
  message: string;
  validator?: () => boolean;
}

export type TagType = "input" | "textarea";

export type ValidateFunc = () => boolean;

export interface PostProps {
  _id?: string;
  title: string;
  excerpt?: string;
  content?: string;
  image?: string;
  createdAt?: string;
  column: string;
  author?: string | UserProps;
  isHTML?: boolean;
}

interface ListProps<T> {
  [key: string]: T;
}

export interface GlobalDataProps {
  user: UserProps;
  columns: { data: ListProps<ColumnProps>; currentPage: number; total: number };
  posts: { data: ListProps<PostProps>; loadedColumns: string[] };
  loading: boolean;
  token: string;
  error: GlobalErrorProps;
}

export interface GlobalErrorProps {
  status: boolean;
  message?: string;
}

export type MessageType = "success" | "error" | "default";

export type UploadStatus = "ready" | "loading" | "success" | "error";

export type BeforeUploadFunction = (file: File) => boolean;

export interface ResponseType<P = {}> {
  code: number;
  msg: string;
  data: P;
}
